const sameNameList = [
  'c',
  'cpp',
  'css',
  'go',
  'h',
  'hex',
  'jar',
  'java',
  'json',
  'pdf',
  'sass',
  'svg',
  'vue',
  'xml',
  'zip',
]

const nameMap = new Map([
  ['txt', 'document'],

  // code
  ['py', 'python'],
  ['class', 'javaclass'],
  ['js', 'javascript'],
  ['kt', 'kotlin'],
  ['md', 'markdown'],

  // font
  ['ttf', 'font'],
  ['ttc', 'font'],
  ['woff', 'font'],
  ['woff2', 'font'],

  // matlab

  ['styl', 'stylus'],
  ['ts', 'typescript'],

  // video
  ['mp4', 'video'],
  ['avi', 'video'],
  ['wmv', 'video'],
  ['m4v', 'video'],
  ['mov', 'video'],
  ['asf', 'video'],
  ['flv', 'video'],
  ['f4v', 'video'],
  ['rmvb', 'video'],

  // image
  ['jpg', 'image'],
  ['png', 'image'],
  ['gif', 'image'],
  ['jpeg', 'image'],
  ['bmp', 'image'],
  ['tiff', 'image'],
  ['raw', 'image'],
  ['eps', 'image'],
  ['svg', 'favicon'],

  // work
  ['doc', 'word'],
  ['docx', 'word'],
  ['ppt', 'powerpoint'],
  ['pptx', 'powerpoint'],
  ['plain', 'file'],
])

const iconMap = new Map()

sameNameList.forEach((name) => {
  nameMap.set(name, name)
})

const context = import.meta.glob('../image/icon/*.svg')

for (const key of nameMap.keys()) {
  iconMap.set(key, context[`../image/icon/${nameMap.get(key)}.svg`])
}

export default iconMap
